#coding:utf8
from rest_framework import serializers
from .models import Area
class AreaSerializer(serializers.ModelSerializer):


    class Meta:
        model = Area
        fields = ['id','name']


class AreaSubSerialier(serializers.ModelSerializer):
    # areas = [Area,Area] 在模型中,也是需要进行 序列化器转换
    # AreaSerializer(areas,many=True)
    # area_set = AreaSerializer(many=True)

    subs =  AreaSerializer(many=True)

    class Meta:
        model = Area
        fields = ['id','name','subs']
